import BaseMonsterSkill from "./BaseMonsterSkill";
import IBaseMonsterSkill from "./IBaseMonsterSkill";
import MonsterScript from "../../../component/MonsterScript";
import SkillEffect from "./SkillEffect";
import Game from "../../Game";





export default class ScaleChangeSkill extends BaseMonsterSkill implements IBaseMonsterSkill {

 
    _timeLine: Laya.TimeLine;

    _scale: any = { value: 40 };

    _speed: number;


    init(target: MonsterScript, skillId) {
        super.init(target, skillId);
        this._speed = this._skillData&&this._skillData.speed?this._skillData.speed:600;
        console.log(this._speed)
        this._timeLine = new Laya.TimeLine();
        this._timeLine.addLabel("small1", 0).to(this._scale, { value: 20 }, this._speed)
            .addLabel("big1", this._speed).to(this._scale, { value: 40 }, this._speed)
            .addLabel("small2", this._speed * 2).to(this._scale, { value: 20 }, this._speed)
            .addLabel("big2", this._speed * 3).to(this._scale, { value: 40 }, this._speed)

    }


    exec() {
        if (this._isSkilling === false) {
            this._isSkilling = true;
            this._timeLine.play(0, true);
        }
        else{

            this._target.setScale(this._scale.value);
        }


    }

    reset() {
        super.reset();
        this._timeLine.reset();
        this._target.resetScale();
    }

  
    destroy() {
        this._target.resetScale();
        super.destroy();
    }





}